<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:74:"/webHome/host6366235/www/public/../application/admin/view/photos/list.html";i:1680612093;}*/ ?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title><?php echo $setting['webname']; ?>-校园生活照片管理</title>
  <meta name="keywords" content="">
  <meta name="description" content="">
  <link href="/public/static/admin/layui27/css/layui.css" rel="stylesheet">
  <link rel="shortcut icon" href="/public/static/favicon.ico">
  <link href="/public/static/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
  <link href="/public/static/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
  <link href="/public/static/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
  <link href="/public/static/admin/css/animate.css" rel="stylesheet">
  <link href="/public/static/admin/css/style.css?v=4.1.0" rel="stylesheet">
  <link href="/public/static/admin/css/plugins/switchery/switchery_smail.css" rel="stylesheet">
  <link href="/public/static/admin/js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">
  <style>
    .update:hover,.del:hover{
       color:#23b7e5;
    }
    .search{
      display: inline-block!important;
      width: 50%;
    }
    .uploadImg{
      float: right;
      display: inline-block;
      margin-top:10px;
      cursor:pointer;
    }
  </style>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
  <div class="row">
    <div class="col-sm-3">
      <div class="ibox float-e-margins">
        <div class="ibox-content">
          <div class="file-manager">
            <div class="hr-line-dashed"></div>
            <h5>照片类型</h5>
            <ul class="folder-list" style="padding: 0">
              <?php foreach($videotype as $val): ?>
              <li><a data-id="<?php echo $val['id']; ?>" class="search" id="search<?php echo $val['id']; ?>"><i class="fa fa-photo"></i> <?php echo $val['name']; ?></a><i class="fa fa-upload uploadImg function-btn" data-videotype="<?php echo $val['id']; ?>" data-method="addvideo" data-type="addvideo" data-text="<?php echo $val['name']; ?>-添加照片" title="为<?php echo $val['name']; ?>添加照片"></i></li>
              <?php endforeach; ?>
            </ul>

            <div class="clearfix"></div>
          </div>
        </div>
      </div>
    </div>
    <div class="col-sm-9 animated fadeInRight">
      <div class="row">
        <div class="col-sm-12" id="filebox">

        </div>
      </div>
    </div>
  </div>
</div>
<!--  添加照片开始  -->
<style>
  #file-upload-box{
    display: none;
    padding-bottom:0px;
  }
  #file-upload-box .form-group div{
    padding:0px;
  }
</style>
<div id="file-upload-box" class="ibox-content">
  <div class="layui-upload">
    <button type="button" class="layui-btn layui-btn-normal" id="testList">选择多文件</button>
    <button type="button" class="layui-btn" id="testListAction">开始上传</button>
    <div class="layui-upload-list" style="max-width: 1000px;">
      <table class="layui-table">
        <colgroup>
          <col>
          <col width="150">
          <col width="160">
          <col width="150">
        </colgroup>
        <thead>
        <tr><th>文件名</th>
          <th>大小</th>
          <th>上传进度</th>
          <th>操作</th>
        </tr></thead>
        <tbody id="demoList"></tbody>
      </table>
    </div>

  </div>
</div>

<!--  修改照片开始  -->
<style>
  #update-file-upload-box,#video_qrcode{
    display: none;
    padding-bottom:0px;
  }
  #update-file-upload-box .form-group div{
    padding:0px;
  }
</style>
<div id="update-file-upload-box" class="ibox-content">
  <form class="form-horizontal" id="updateFileUploadForm">
    <!--照片标题-->
    <div class="form-group">
      <label class="col-sm-3 control-label">照片标题：</label>
      <div class="col-sm-8">
        <input type="text" name="title" placeholder="照片标题" class="form-control" id="update_title" autofocus="true">
        <input type="hidden" name="id" class="form-control" id="update_id" autofocus="true">
        <span class="help-block m-b-none"></span>
      </div>
    </div>
    <!--照片关键词-->
    <div class="form-group">
      <label class="col-sm-3 control-label">关键词：</label>
      <div class="col-sm-8">
        <input type="text" name="keywords" placeholder="关键词" class="form-control" id="update_keywords" autofocus="true">
        <span class="help-block m-b-none">多个关键词之间使用逗号“,”隔开</span>
      </div>
    </div>
    <!--照片描述-->
    <div class="form-group">
      <label class="col-sm-3 control-label">照片描述：</label>
      <div class="col-sm-8">
        <input type="text" name="description" placeholder="照片描述" class="form-control" id="update_description" autofocus="true">
        <span class="help-block m-b-none"></span>
      </div>
    </div>
    <!--照片分类-->
    <div class="form-group">
      <label class="col-sm-3 control-label">照片分类：</label>
      <div class="col-sm-8">
        <select name="videotype" id="update_videotype" class="form-control">
          <option value="">请选择所属类型</option>
          <?php foreach($videotype as $val): ?>
          <option value="<?php echo $val['id']; ?>"><?php echo $val['name']; ?></option>
          <?php endforeach; ?>
        </select>
        <span class="help-block m-b-none"></span>
      </div>
    </div>
    <!--照片-->
    <div class="form-group">
      <label class="col-sm-3 control-label">照片：</label>
      <div class="col-sm-8">
        <input type="button" class="btn btn-success" value="已上传的照片" id="update_selffile">
        <button type="button" class="btn btn-info" id="update_test1">上传照片</button>
        <div class="layui-upload-list">
          <img class="layui-upload-img" id="update_demo1" style='max-width:100%'>
          <p id="update_demoText"></p>
        </div>
      </div>
    </div>

    <!--排序-->
    <div class="form-group">
      <label class="col-sm-3 control-label">照片排序：</label>
      <div class="col-sm-8">
        <input type="number" name="sort" placeholder="照片排序" class="form-control" id="update_sort" autofocus="true">
        <span class="help-block m-b-none"></span>
      </div>
    </div>
    <!--状态-->
    <div class="form-group">
      <label class="col-sm-3 control-label">照片状态：</label>
      <div class="col-sm-8">
        <select name="status" id="update_status" class="form-control">
          <option value="1">显示</option>
          <option value="2">隐藏</option>
        </select>
        <span class="help-block m-b-none"></span>
      </div>
    </div>
  </form>
</div>
<!--  修改照片结束  -->



<link rel="stylesheet" href="/public/static/admin/css/imglist.css">
<!--弹出已上传的照片-->
<div class="layer_notive" >
  <ul id="imglist"></ul>
  <div style="clear:both"></div>
</div>

<script src="/public/static/admin/layui27/layui.js"></script>
<!-- 全局js -->
<script src="/public/static/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/public/static/admin/js/bootstrap.min.js?v=3.3.6"></script>

<!-- 自定义js -->
<script src="/public/static/admin/js/content.js?v=1.0.0"></script>
<!-- iCheck -->
<script src="/public/static/admin/js/plugins/iCheck/icheck.min.js"></script>
<!-- Switchery -->
<script src="/public/static/admin/js/plugins/switchery/switchery.js"></script>

<!-- Fancy box -->
<script src="/public/static/admin/js/plugins/fancybox/jquery.fancybox.js"></script>

<script>
  $(document).ready(function () {
    // 文件有动态效果
    // $('.file-box').each(function () {
    //   animationHover(this, 'pulse');
    // });
    search("<?php echo $videtype_id; ?>");
    $('.fancybox').fancybox({
      openEffect: 'none',
      closeEffect: 'none'
    });
  });

  var $imgpath = "/public/static/admin/uploads/photo/";
  var photo = "";
  var video_data = null;
  var update_photo = "";


  layui.use(['upload','element','layer'], function() { //独立版的layer无需执行这一句
    var $ = layui.jquery, layer = layui.layer,upload = layui.upload,element=layui.element; //独立版的layer无需执行这一句
    //查询文件
    $(".search").on("click",function(){
       search($(this).data('id'));
    })
    //编辑文件
    //删除照片
    $("#filebox").on("click",".del",function(){
      var title = $(this).data("title");
      var id = $(this).data("id");
      var videotype = $(this).data("videotype");
      top.layer.msg("你确定要删除\""+title+"\"这个照片吗？",{
        time:1000*60*5,
        shade:0.8,
        btn:["确定","取消"],
        yes:function(){
          $.post("<?php echo url('Photos/video_del'); ?>",{id,videotype},function(data){
            top.layer.msg(data.msg,{time:2000,shade:0.8},function(){
              if(data.url){
                window.location = data.url;
              }
            })
          })
        }
      })
    })

    var active = {
      //弹出添加照片的表单
      addvideo:function(othis){
        var text = othis.data("text")
            ,type= othis.data("type")
            ,videotypes = othis.data("videotype");
        $("#testListAction").attr("data-videotype",videotypes)
        var actMsg = layer.open({
           type: 1
          , title: text
          , offset: [ //弹窗坐标
              ($(window).height() / 2) - 290
            , ($(window).width() / 2) - 300
          ]
          , area: ['600px', '580px']
          , id: 'layerDemo' + type //防止重复弹出
          , content: $("#file-upload-box")
          // , btn: ['保存', '取消']
          , btnAlign: 'c' //按钮居中
          , shade: 0.5 //不显示遮罩
          , moveType: 1 //拖拽模式，0或者1
          ,end: function () {
            $("#file-upload-box").hide();
            layer.close(actMsg);
          }
        });
      },
      //天厨修改照片的表单
      update_video:function(othis){
        var text = othis.data("text")
                ,type= othis.data("type")
                ,index= othis.data("index");
       //添加数据
        $("#update_id").val(video_data[index].id);
        $("#update_title").val(video_data[index].title);
        $("#update_keywords").val(video_data[index].keywords);
        $("#update_description").val(video_data[index].description);
        $("#update_videotype option[value="+video_data[index].videotype+"]").prop("selected",true);
        $("#update_demo1").attr("src",video_data[index].video_cover);
        $("#update_sort").val(video_data[index].sort);
        $("#update_status option[value="+video_data[index].status+"]").prop("selected",true);

        var updateMsg = layer.open({
          type: 1
          , title: text
          , offset: [ //弹窗坐标
            ($(window).height() / 2) - 290
            , ($(window).width() / 2) - 195
          ]
          , area: ['400px', '580px']
          , id: 'layerDemo' + type //防止重复弹出
          , content: $("#update-file-upload-box")
          , btn: ['保存', '取消']
          , btnAlign: 'c' //按钮居中
          , shade: 0.5 //不显示遮罩
          , moveType: 1 //拖拽模式，0或者1
          , yes: function () {
            //获取表单的所有内容
            var form = $("#updateFileUploadForm").serializeArray();
            var data = {};
            for (item of form) {
              data[item.name] = item.value
            }
            if (update_photo){
              data['video_cover'] = $imgpath+update_photo;
            }else{
              data["video_cover"] = video_data[index].video_cover
            }
            data['keywords'] = data['keywords'].replace(/，/ig,",");
            //逐个判断是否为空
            if (!data.title) { layer.msg("请输照片标题", {time: 2000, shade: 0.5}, function () { $("#update_title").focus(); });return ;}
            if (!data.keywords) { layer.msg("请输入关键词", {time: 2000, shade: 0.5}, function () { $("#update_keywords").focus();}); return ;}
            if (!data.description) { layer.msg("请输入照片描述", {time: 2000, shade: 0.5}, function () { $("#update_description").focus(); });return ;}
            if (!data.videotype) { layer.msg("请选择照片类型", {time: 2000, shade: 0.5}, function () { $("#update_videotype").focus(); }); return;}
            if (!data.sort) { layer.msg("请输入排序", {time: 2000, shade: 0.5}, function () { $("#update_sort").focus(); });return ;}

            // 保存专业类型
            $.post("<?php echo url('Photos/update_video'); ?>", data, function (back_data) {
              layer.msg(back_data.msg, {time: 2000, shade: 0.5}, function () {
                if (back_data.url) {
                  //得到重新刷新的地址，并且后面携带tab编号（tab编号为报考类型的id，从控制器返回的结果中获得）,不能使用#号，会导致window.open() 不刷新。
                  //默认选择当前报考类型
                  window.open(back_data.url,"_self");
                }
              })
            });
          }
          , btn2: function () {
            $("#update-file-upload-box").hide();
            layer.close(updateMsg);
          },end: function () {
            $("#update-file-upload-box").hide();
            layer.close(updateMsg);
          }
        });
      },
      //弹出二维码
      video_qrcode:function(othis){
        var text = othis.data("text")
                ,type= othis.data("type")
                ,qrcode= othis.data("qrcode")
        $("#qrcode").attr("src",$qrcode+qrcode);
        var qrMsg = layer.open({
          type: 1
          , title: text
          , offset: [ //弹窗坐标
            ($(window).height() / 2) - 200
            , ($(window).width() / 2) - 200
          ]
          , area: ['400px', '400px']
          , id: 'layerDemo' + type //防止重复弹出
          , content: $("#video_qrcode")
          , btn: ['保存', '取消']
          , btnAlign: 'c' //按钮居中
          , shade: 0.5 //不显示遮罩
          , moveType: 1 //拖拽模式，0或者1
          , yes: function () {
              var $a = $("<a></a>").attr("href", $qrcode+qrcode).attr("download", text);
              $a[0].click();
          }
          , btn2: function () {
            layer.close(qrMsg);
          }
        });
      },
      qrcode_refersh:function(othis){
        $.post("<?php echo url('Photos/re_qrcode'); ?>",{id:othis.data("id"),videotype:othis.data('videotype')},function(data){
            top.layer.msg(data.msg,{time:2000,shade:0.5},function(){
              if(data.url){
                window.location = data.url;
              }
            });

        })
      }
    }

    //普通照片上传
    var uploadInst = upload.render({
      elem: '#test1'
      ,url: "<?php echo url('Photos/upload_cover'); ?>"
      ,before: function(obj){
        //预读本地文件示例，不支持ie8
        obj.preview(function(index, file, result){
          $('#demo1').attr('src', result); //照片链接（base64）
        });
      }
      ,done: function(res){
        //如果上传失败
        if(res.code == 0){
          return top.layer.msg('上传失败',{shade:0.5});
        }else if(res.code){
          //上传成功
          photo = res.photo;
          return top.layer.msg('上传成功',{shade:0.5});
        }
      }
      ,error: function(){
        //演示失败状态，并实现重传
        var demoText = $('#demoText');
        demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
        demoText.find('.demo-reload').on('click', function(){
          uploadInst.upload();
        });

      }
    });
    //演示多文件列表
    var uploadListIns = upload.render({
      elem: '#testList'
      ,elemList: $('#demoList') //列表元素对象
      ,url: "<?php echo url('Photos/upload_cover_more'); ?>" //此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
      ,data:{
        videotype: function(){
          return $("#testListAction").data("videotype");
        }
      }
      ,accept: 'file'
      ,multiple: true
      ,number: 100
      ,auto: false
      ,bindAction: '#testListAction'
      ,choose: function(obj){
        var that = this;
        var files = this.files = obj.pushFile(); //将每次选择的文件追加到文件队列
        //读取本地文件
        obj.preview(function(index, file, result){
          var tr = $(['<tr id="upload-'+ index +'">'
            ,'<td>'+ file.name +'</td>'
            ,'<td>'+ (file.size/1014).toFixed(1) +'kb</td>'
            ,'<td><div class="layui-progress" lay-filter="progress-demo-'+ index +'"><div class="layui-progress-bar" lay-percent=""></div></div></td>'
            ,'<td>'
            ,'<button class="layui-btn layui-btn-xs demo-reload layui-hide">重传</button>'
            ,'<button class="layui-btn layui-btn-xs layui-btn-danger demo-delete">删除</button>'
            ,'</td>'
            ,'</tr>'].join(''));

          //单个重传
          tr.find('.demo-reload').on('click', function(){
            obj.upload(index, file);
          });

          //删除
          tr.find('.demo-delete').on('click', function(){
            delete files[index]; //删除对应的文件
            tr.remove();
            uploadListIns.config.elem.next()[0].value = ''; //清空 input file 值，以免删除后出现同名文件不可选
          });

          that.elemList.append(tr);
          element.render('progress'); //渲染新加的进度条组件
        });
      }
      ,done: function(res, index, upload){ //成功的回调
        var that = this;
        if(res.code == 0){ //上传成功
          var tr = that.elemList.find('tr#upload-'+ index)
                  ,tds = tr.children();
          tds.eq(3).html(''); //清空操作
          delete this.files[index]; //删除文件队列已经上传成功的文件
          return;
        }
        this.error(index, upload);
      }
      ,allDone: function(obj){ //多文件上传完毕后的状态回调
        layer.msg("所有文件上传完毕",{time:2000,shade:0.5},function(){
          $("#demoList").empty();
          layer.closeAll();
          document.location.href = "/public/index.php/admin/Photos/lists/videotype/"+$("#testListAction").data("videotype");
        });
      }
      ,error: function(index, upload){ //错误回调
        var that = this;
        var tr = that.elemList.find('tr#upload-'+ index)
                ,tds = tr.children();
        tds.eq(3).find('.demo-reload').removeClass('layui-hide'); //显示重传
      }
      ,progress: function(n, elem, e, index){ //注意：index 参数为 layui 2.6.6 新增
        element.progress('progress-demo-'+ index, n + '%'); //执行进度条。n 即为返回的进度百分比
      }
    });
    //显示本地照片
    $("#selffile").click(function () {
      $.post("<?php echo url('Base/getmyfiles'); ?>",{path:$imgpath},function(data){
        var str = "";
        for( i in data.msg){
          str += "<li><img src='"+$imgpath+data.msg[i]+"' class='imglist' data-photo='"+data.msg[i]+"' onclick='changecss(this)' alt=''><div class='del_div'><i class='fa fa-close del' title='删除' data-path='"+$imgpath+data.msg[i]+"'></i></div></li>";
        }
        $("#imglist").html(str);
        //页面层
       var local_file =  layer.open({
          type: 1,
          skin: false, //加上边框
          title: "已上传的照片",
          area: ['720px', '600px'], //宽高
          btn:["确认","取消"],
          content: $(".layer_notive"),  //调到新增页面
          yes:function(){
            var newImgsrc = $(".active").attr("src");
            var newImgname = $(".active").data("photo");
            $('#demo1').attr('src', newImgsrc); //照片链接（base64）
            $('#demo1').attr('width','100%');
            photo = newImgname;
            layer.close(local_file);
          }
         ,end: function () {
           $(".layer_notive").hide();
           layer.close(updateMsg);
         }
        });
      });
    });
    //删除照片
    $("#imglist").on("click",".del",function(v){
      $this = $(this);
      //页面层
      top.layer.msg('你确定要删除这张照片吗?', {
        time: 20000, //20s后自动关闭
        shade:0.5,
        btn: ['确定', '取消'],
        yes:function(){
          var data  = {
            "path" : $this.data("path")
          }
          $.post("<?php echo url('Base/delfile'); ?>",data,function(data){
            top.layer.msg(data.msg,{time:2000,shade:0.5},function(){
              $.post("<?php echo url('Base/getmyfiles'); ?>",{path:$imgpath},function(data) {
                console.log(data);
                var str = "";
                for (i in data.msg) {
                  str += "<li><img src='"+$imgpath + data.msg[i] + "' class='imglist' data-photo='" + data.msg[i] + "' onclick='changecss(this)' alt=''><div class='del_div'><i class='fa fa-close del' title='删除' data-path='"+$imgpath + data.msg[i] + "'></i></div></li>";
                }
                $("#imglist").html(str);
              });
            });
          });
        }
      });
    });



    /*--------------------------------------------------------------------------------------*/

    //修改普通照片上传
    var update_uploadInst = upload.render({
      elem: '#update_test1'
      ,url: "<?php echo url('Photos/upload_cover'); ?>"
      ,before: function(obj){
        //预读本地文件示例，不支持ie8
        obj.preview(function(index, file, result){
          $('#update_demo1').attr('src', result); //照片链接（base64）
        });
        load = layer.load(1,{time:1000*60*10,shade:0.5}); //搜索等待特效
      }
      ,done: function(res){
        //如果上传失败
        if(res.code == 0){
          layer.close(load);
          return top.layer.msg('上传失败',{shade:0.5});
        }else if(res.code){
          //上传成功
          update_photo = res.photo;
          layer.close(load);
          return top.layer.msg('上传成功',{shade:0.5});
        }

      }
      ,error: function(){
        //演示失败状态，并实现重传
        var demoText = $('#demoText');
        demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
        demoText.find('.demo-reload').on('click', function(){
          update_uploadInst.upload();
        });
      }
    });
    //修改显示本地照片
    $("#update_selffile").click(function () {
      $.post("<?php echo url('Base/getmyfiles'); ?>",{path:$imgpath},function(data){
        console.log(data);
        var str = "";
        for( i in data.msg){
          str += "<li><img src='"+$imgpath+data.msg[i]+"' class='imglist' data-photo='"+data.msg[i]+"' onclick='changecss(this)' alt=''><div class='del_div'><i class='fa fa-close del' title='删除' data-path='"+$imgpath+data.msg[i]+"'></i></div></li>";
        }
        $("#imglist").html(str);
        //页面层
        var local_file =  layer.open({
          type: 1,
          skin: false, //加上边框
          title: "已上传的照片",
          area: ['720px', '600px'], //宽高
          btn:["确认","取消"],
          content: $(".layer_notive"),  //调到新增页面
          yes:function(){
            var newImgsrc = $(".active").attr("src");
            var newImgname = $(".active").data("photo");
            $('#update_demo1').attr('src', newImgsrc); //照片链接（base64）
            $('#update_demo1').attr('width','100%');
            update_photo = newImgname;
            layer.close(local_file);
          }
          ,end: function () {
            $(".layer_notive").hide();
            layer.close(updateMsg);
          }
        });
      });
    });





    $('.gray-bg').on('click', ".function-btn",function(){
      var othis = $(this), method = othis.data('method');
      active[method] ? active[method].call(this, othis) : '';
    });
  });

  //点击照片选择照片
  function changecss(obj){
    $(".imglist").removeClass("active");
    $(obj).addClass("active");
  }
  //查询当前分类的id
  function search(id){
    $(".search").css("color","#666");
    $("#search"+id).css("color","#23b7e5")
    var str = ""
    $.post("<?php echo url('Photos/videolist'); ?>",{typeid:id},function(data){
      video_data = data
       if(data.length >0) {
         var i = 0
         for (item of data) {
           var ck = item.status == 1 ? "checked" : "";
           str += "<div class=\"file-box\">" +
                   "<div class=\"file\">" +
                   "<span class=\"corner\"></span>" +
                   "<div class=\"icon\">" +
                   "<div class='fancybox' title='"+item.title+"' href='"+item.video_cover+"' style='cursor:pointer;width: 100%;height:100%;background-size:100% auto;background-position:center;background-image:url(" + item.video_cover + ")'></div>" +
                   "</div>" +
                   "<div class=\"file-name\">" + item.title + "<br/>" +
                   "<small>添加时间：" + item.create_time + "</small>" +
                   "<div style='line-height: 25px;'> <i title='编辑' data-type='update_video' data-text='修改照片' class=\"update fa fa-pencil function-btn\" data-method='update_video' data-index=\"" + i + "\"></i> <i title='删除' style='float: right;margin-top:7px;margin-left:5px;' data-title='" + item.title + "' data-videotype='" + item.videotype + "' class=\"del fa fa-trash-o\" data-id=\"" + item.id + "\"></i> <div style='display:inline-block;float:right'> <input type='checkbox' class='js-switch' data-id='" + item.id + "' title='显示与隐藏' " + ck + " /></div></div>" +
                   "</div>" +
                   "</div>" +
                   "</div>";
           i++;
         }
       }else{
         str += "<div style=\"color:#666\">暂无数据</div>";
       }
       $("#filebox").html("");
       $("#filebox").html(str);

      //状态的切换按钮的初始化样式
      var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
      elems.forEach(function(html) {
        var switchery = new Switchery(html,{ size: 'small' });
      });

    })
  }




  //修改状态
  $("#filebox").on("change",".js-switch",function(){
    var checkedS = $(this).is(":checked");
    var ids = $(this).data("id");
    var st = "";
    var str = "";
    if(checkedS){
      st = 1;
      str = "显示";
    }else{
      st = 2;
      str = "隐藏";
    }
    $.post("<?php echo url('Photos/VideoStatus'); ?>",{id:ids,status:st},function(data){
      layer.msg(str+data.msg,{time:2000});
    });
  });
</script>




</body>

</html>
